#include "stdParticle.h"

stdParticle::stdParticle()
{
	reset();
}

bool stdParticle::check_remove()
{
	return _remove;
}

void stdParticle::setInformation(int num, int time, float vx, float vy,
	float ax, float ay, Point p)
{
	Resource* r = 0;
	r = r->Instance();
	_bitmap.setInformation(r->_praticle, num, num, p, 1);
	_vx = vx;
	_vy = vy;
	_ax = ax;
	_ay = ay;
	_time = time;
	_remove = false;
}

void stdParticle::reset()
{
	_vx = _vy = _ax = _ay = 0;
	_time = 0;
	_remove = false;
}

void stdParticle::draw()
{
	al_draw_tinted_bitmap_region(_bitmap.bitmap[0], 
		al_map_rgba(_color, _color, _color, _color),
		_round, _round, _round, _round, _bitmap.p.x,
		_bitmap.p.y, 0);
}

void stdParticle::updata()
{
	_time--;
	if (_time < 0)
	{
		_remove = true;
		return;
	}
	move();
}

void stdParticle::move()
{
	_bitmap.p.x += _vx;
	_bitmap.p.y += _vy;
	_vx += _ax;
	_vy += _ay;
	_round += _around;
}